/**
 * 
 */
package com.android.booksreader;

import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Align;

/**
 * @author revees
 *         <p>
 *         该类作为电子书的内容控制类，控制翻页以及读取段落以及段落的绘制
 */
public class PageViewFactory {

	private int width, height;
	private Paint paint;
	private int fontColor = Color.BLACK;
	private int backColor = Color.DKGRAY;
	private float fontSize = 24;
	private int margeWidth = 10; // 左右到边框的距离
	private int margeHeight = 20; // 上下到边框的距离
	private int visableWidth, visableHeight; // 绘制文字的宽度和高度
	private int maxLine;
	private Bitmap bg;

	public PageViewFactory(int width, int height) {
		this.width = width;
		this.height = height;
		// 设置画笔
		paint = new Paint(Paint.ANTI_ALIAS_FLAG);
		paint.setTextAlign(Align.LEFT);
		paint.setTextSize(fontSize);
		paint.setColor(fontColor);
		// 计算可以显示的文本的最大宽度和高度以及可以显示的最大行数
		visableWidth = width - 2 * margeWidth;
		visableHeight = height - 2 * margeHeight;
		maxLine = (int) (visableHeight / fontSize);
	}

	public void setBg(Bitmap bg) {
		this.bg = bg;
	}

}
